package top.zxybird.yun.common.util;

import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;

import java.lang.reflect.Method;
import java.util.Map;

public class BeanUtils {

  public static Map<String, Class> getInterfaceReturnClass(Class interfaceCls) {
    Preconditions.checkArgument(null != interfaceCls, "Param interfaceCls should not be null!");
    Preconditions.checkArgument(interfaceCls.isInterface(), "Param interfaceCls should be a Interface!");
    Method[] methods = interfaceCls.getMethods();
    Map<String, Class> ret = Maps.newHashMapWithExpectedSize(methods.length);
    for (Method method : methods) {
      String methodName = method.getName();
      Class returnCls = method.getReturnType();
      ret.put(methodName, returnCls);
    }
    return ret;
  }

}
